package org.lsms.dao;

/**
 * interface that used to interact with the database
 * @author ZhanXueliang 
 * create 2010.8.7
 * last update 2010.8.29
 */

import java.sql.Date;
import java.sql.ResultSet;
import java.util.HashMap;

import org.lsms.bean.*;

	public interface DAO {
	/**
	 * check the information when user login
	 * @param user
	 * @return
	 */
	public boolean login(User user);
	/**
	 * insert information to the database when user sign up
	 * @param user
	 * @return
	 */
	public boolean signup(User user);
	/**
	 * get user id according to the login name
	 * @param loginname
	 * @return
	 */
	public int get_user_id(String loginname);
	/**
	 * get user login times according to the login name 
	 * @param loginname
	 * @return
	 */
	public int get_user_login_times(String loginname);
	/**
	 * update user's login times,every login,plus one
	 * @param loginname
	 * @return
	 */
	public boolean update_login_times(String loginname);
	/**
	 * update user's last login time
	 * @param user
	 * @return
	 */
	public boolean update_last_login(User user);
	/**
	 * update user info when user modify his/her personal info
	 * @param user
	 * @param userid
	 * @return
	 */
	public boolean update_user_info(User user,int userid);
	/**
	 * insert paper's info into database
	 * @param paper
	 * @return
	 */
	public boolean submit_paper(Paper paper);
	/**
	 * get all topics
	 * @return
	 */
	public HashMap select_all_topic();
	/**
	 * select one author's all paper
	 * @param userid
	 * @return
	 */
	public HashMap select_all_paper(int userid);
	/**
	 * get all the paper that assign to a certain 
	 * member according to member id
	 * @param member_id
	 * @return
	 */
	public HashMap select_paper_assign1(int member_id);
	/**
	 * get the date when chair assign a certain paper to a certain 
	 * member according to the paper id
	 * @param paper_id
	 * @return
	 */
	public Date get_paper_assign1_date(int paper_id);
	/**
	 * get the paper that has passed,according to the user id
	 * @param userid
	 * @return
	 */
	public HashMap select_passed_paper(int userid);
	/**
	 * get paper save name according to the paper id
	 * @param paperid
	 * @return
	 */
	public String get_paper_sava_name(int paperid);
	/**
	 * check the login name,make sure that the login name is 
	 * distinct
	 * @param loginname
	 * @return
	 */
	public boolean check_login_name(String loginname);
	/**
	 * insert topic information into database 
	 * @param userid
	 * @param topic1
	 * @param topic2
	 * @param topic3
	 * @param topic4
	 * @return
	 */
	public boolean select_topic(int userid,String topic1,String topic2,String topic3,String topic4);
	/**
	 * insert relationship between member and reviewer into database 
	 * @param member_id
	 * @param reviewer_id
	 * @return
	 */
	public boolean add_relation_tie(int member_id,int reviewer_id);
	/**
	 * get confirm information of all reviewers,judge according reviewer's 
	 * login times
	 * @param pcmember_id
	 * @return
	 */
	public HashMap select_reviewer_conf(int pcmember_id);
	/**
	 * get confirm information of all members,judge according member's 
	 * login times
	 * @return
	 */
	public HashMap select_member_conf();
	/**
	 * get the accepted members' information
	 * @return
	 */
	public HashMap select_accept_member();
	/**
	 * get information of the site setting
	 * @return
	 */
	public HashMap get_site_setting();
	/**
	 * update the site setting information
	 * @param setting
	 * @return
	 */
	public boolean upload_site_setting(int [] setting);
	/**
	 * get the users' topic information according to login name
	 * @param loginname
	 * @return
	 */
	public String user_select_topics_info(String loginname);
	/**
	 * get the total number of paper that have assigned to a 
	 * certain member
	 * @param loginname
	 * @return
	 */
	public int get_paper_assign1_num(String loginname);
	/**
	 * get a user's complete information according to user id
	 * @param user_id
	 * @return
	 */
	public User get_user_info(int user_id);
	/**
	 * get the information of paper which has been assigned to 
	 * a certain member.LIMIT function was used.
	 * @param member_id
	 * @param page_count
	 * @param row
	 * @return
	 */
	public HashMap get_paper_assign1(int member_id,int page_count,int row);
	/**
	 * get the number of the paper that havn't been assigned yet.
	 * @return
	 */
	public int get_unassigned1_num();
	/**
	 * get the information of paper which has not been assigned to 
	 * a certain member.LIMIT function was used. 
	 * @param a_page_count
	 * @param a_row
	 * @return
	 */
	public HashMap get_paper_unassign1(int a_page_count,int a_row);
	/**
	 * insert information into table lsms_paper_assign_1 
	 * @param paper_id
	 * @param member_id
	 * @return
	 */
	public boolean paper_assign1(int paper_id,int member_id);
	/**
	 * get the number of the paper that have been assigned to a 
	 * certain reviewer by a certain member 
	 * @param member_id
	 * @param paper_id
	 * @return
	 */
	public int get_paper_assign_reviewer_num(int member_id,int paper_id);
	/**
	 * get the complete information of one paper according to paper id 
	 * @param paper_id
	 * @return
	 */
	public Paper get_paper_info(int paper_id);
	/**
	 * get the content of the topic according to the topic name
	 * @param topicname
	 * @return
	 */
	public String get_topic_content(String topicname);
	/**
	 * get the paper assign information between member and reviewer
	 * @param paper_id
	 * @param member_id
	 * @param page_count
	 * @param row
	 * @return
	 */
	public HashMap get_paper_assign2(int paper_id,int member_id,int page_count,int row);
	/**
	 * get the number of reviewers for one paper
	 * @param paper_id
	 * @param member_id
	 * @return
	 */
	public int get_reviewer_num_of_one_paper(int paper_id,int member_id);
	/**
	 * get the status of the paper which has been assigned to a certain 
	 * reviewer
	 * @param paper_id
	 * @param member_id
	 * @param reviewer_id
	 * @return
	 */
	public int get_paper_assign2_status(int paper_id,int member_id,int reviewer_id);
	/**
	 * get the number of reviewers that havn't been assigned to a 
	 * certain paper according to the paper_id
	 * @param paper_id
	 * @return
	 */
	public int get_unassign2_num(int paper_id);
	/**
	 * get all the reviewers that havn't been assigned to a 
	 * certain paper according to the paper_id
	 * @param paper_id
	 * @param a_page_count
	 * @param a_row
	 * @return
	 */
	public HashMap get_reviewer_unassign2(int paper_id,int a_page_count,int a_row);
	/**
	 * get the number of the paper which have assigned to a certain reviewer
	 * @param reviewer_id
	 * @return
	 */
	public int get_reviewer_assign_num(int reviewer_id);
	/**
	 * insert information into table lsms_paper_assign_2
	 * @param member_id
	 * @param reviewer_id
	 * @param paper_id
	 * @return
	 */
	public boolean paper_assign2(int member_id,int reviewer_id,int paper_id);
	/**
	 * get all the paper that assigned to a certain reviewer
	 * @param reviewer_id
	 * @return
	 */
	public HashMap get_paper_assigned_to_reviewer(int reviewer_id);
	/**
	 * insert paper grade information into table lsms_paper_grade
	 * @param paper_grade
	 * @param reviewer_id
	 * @param paper_id
	 * @return
	 */
	public boolean paper_grade(Paper_Grade paper_grade,int reviewer_id,int paper_id);
	/**
	 * update the assign status in the table lsms_paper_assign_2
	 * @param paper_id
	 * @param reviewer_id
	 * @return
	 */
	public boolean update_paper_assign2_status(int status,int paper_id,int reviewer_id);
	/**
	 * get the paper that have not been decided yet
	 * @param member_id
	 * @param page_count
	 * @param row
	 * @return
	 */
	public HashMap get_member_undecision_paper(int member_id,int page_count,int row);
	/**
	 * get the number of paper that have not been decided yet
	 * @param member_id
	 * @return
	 */
	public int get_member_undecision_paper_num(int member_id);
	/**
	 * get the grade information for one paper
	 * @param paper_id
	 * @return
	 */
	public HashMap get_paper_grade(int paper_id);
	/**
	 * insert member's comment into table lsms_paper_comment 
	 * @param paper_id
	 * @return
	 */
	public boolean member_paper_comment(int paper_id,String member_to_chair,int recommend);
	/**
	 * update paper assign status information in 
	 * the table lsms_paper_assign_1
	 * @param paper_id
	 * @param reviewer_id
	 * @return
	 */
	public boolean update_paper_assign_1_status(int status,int paper_id,int member_id);
	/**
	 * get all paper information
	 * @param page_count
	 * @param row
	 * @return
	 */
	public HashMap get_all_paper(int page_count,int row);
	/**
	 * get the number of all papers
	 * @return
	 */
	public int get_num_of_all_paper();
	/**
	 * update paper status in the talbe lsms_paper
	 * @param status
	 * @param paper_id
	 * @return
	 */
	public boolean update_paper_status(int status,int paper_id);
	/**
	 * get the comment from pc member for a certain paper
	 * @param paper_id
	 * @return
	 */
	public HashMap get_member_comment(int paper_id);
	/**
	 * reset the password according to the login name and email
	 * @param loginname
	 * @param email
	 * @return
	 */
	public boolean reset_pass(String loginname,String email);
	/**
	 * get all the topics classified by topic_clall order by topic_id
	 * @return
	 */
	public HashMap get_all_topic();
	/**
	 * get the email content from database
	 * @param content_id
	 * @return
	 */
	public String get_mail_content(int content_id);
	/**
	 * get the max ID of the paper
	 * @return
	 */
	public int get_max_paper_id();
	/**
	 * get the paper contact mail according to the paper status
	 * @param type
	 * @return
	 */
	public HashMap get_paper_contact_mail(int type,int start_id);
	/**
	 * get the information of news according to the news_id
	 * @param news_id
	 * @return
	 */
	public News get_news_info(int news_id);
	/**
	 * get the max id of the news
	 * @return
	 */
	public int get_max_id_news();
	/**
	 * index upload
	 * @param paper_id
	 * @param type
	 * @param savename
	 * @return
	 */
	public boolean materail_upload(int paper_id,int type,String savename);
	/**
	 * get all the news and notices
	 * @return
	 */
	public HashMap get_all_news();
	/**
	 * administrator release a new note
	 * @return
	 */
	public boolean release_new_note(News news);
	/**
	 * administrator modify mail content
	 * @param content
	 * @param content_id
	 * @return
	 */
	public boolean modify_mail_content(String content,int content_id);
	/**
	 * get content of the note from a reviewer to a certain paper 
	 * @param paper_id
	 * @param reviewer_id
	 * @return
	 */
	public HashMap member_see_note(int paper_id,int reviewer_id);
	/**
	 * insert chair comment on a certain paper to table lsms_paper_comment_2 
	 * @param paper_id
	 * @param comment
	 * @return
	 */
	public boolean chair_comment(int paper_id,String comment);
	/**
	 * get the suggestion to author for a certain paper
	 * @param paper_id
	 * @return
	 */
	public String get_chair_suggestion(int paper_id);
	/**
	 * get reviewers' suggestion to author 
	 * @param paper_id
	 * @return
	 */
	public HashMap get_reviewer_suggrstion(int paper_id);
	}
